<?php

namespace App\Console;

use App\Console\Commands\AllBetCommand;
use App\Console\Commands\ClearBet;
use App\Console\Commands\RecordCommand;
use App\Console\Commands\TransferCheckCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        TransferCheckCommand::class,
        RecordCommand::class,
        ClearBet::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        if (app()->environment() == 'product') {
            $schedule->command('get:record --plat=tcg --interval=1 --delay=6')->name('tcg_bet_record')->everyMinute();
            $schedule->command('get:record --plat=allbet --interval=10 --firstMaxPullTime=10')->name('allbet_bet_record')->everyFiveMinutes();
            $schedule->command('get:record --plat=dt')->name('dt_bet_record')->everyMinute();
            $schedule->command('get:record --plat=ibc --interval=720   --delay=15')->name('ibc_bet_record')->everyMinute();
            $schedule->command('get:record --plat=ky')->name('ky_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=mg')->name('mg_bet_record')->everyMinute();
            $schedule->command('get:record --plat=og --interval=40 --firstMaxPullTime=40 --delay=30')->name('og_bet_record')->cron('*/10 * * * *');
//            $schedule->command('get:record --plat=og --interval=58 --firstMaxPullTime=58 --delay=30')->name('og_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=pt --interval=30 --delay=10')->name('pt_bet_record')->everyFiveMinutes();
//            $schedule->command('get:record --plat=pts')->name('pts_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=qt')->name('qt_bet_record')->everyMinute();
            $schedule->command('get:record --plat=ag  --interval=5  --firstMaxPullTime=5 --delay=4')->name('ag_bet_record')->everyMinute()->withoutOverlapping();
//            $schedule->command('get:record --plat=vr  --interval=58 --delay=5')->name('vr_bet_record')->everyMinute();
            $schedule->command('get:record --plat=vr  --interval=40  --firstMaxPullTime=40 --delay=5')->name('vr_bet_record')->cron('*/10 * * * *');
            $schedule->command('get:record --plat=bbin  --interval=40  --firstMaxPullTime=40 --delay=15')->name('bbin_bet_record')->cron('*/10 * * * *');
            $schedule->command('get:record --plat=fy  --interval=30')->name('fy_bet_record')->everyMinute();
            $schedule->command('get:record --plat=sa  --interval=30')->name('sa_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=cq9  --interval=15')->name('cq9_bet_record')->everyMinute();
            $schedule->command('get:record --plat=sgcp  --interval=3')->name('sgcp_bet_record')->everyMinute();
            $schedule->command('get:record --plat=ig  --interval=10  --firstMaxPullTime=10 --delay=15')->name('ig_bet_record')->everyMinute();
            $schedule->command('get:record --plat=sgqp  --interval=10  --firstMaxPullTime=10 --delay=15')->name('sgqp_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=ebet')->name('ebet_bet_record')->everyFiveMinutes();
            $schedule->command('get:record --plat=ebet  --interval=5  --firstMaxPullTime=5 --delay=5')->name('ebet_bet_record')->everyMinute();
            $schedule->command('get:record --plat=vg')->name('vg_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=sc  --interval=30')->name('sc_bet_record')->everyMinute();
            $schedule->command('get:record --plat=sc  --interval=30')->name('sc_bet_record')->cron('*/5 * * * *');
            $schedule->command('get:record --plat=sunbet  --interval=6  --firstMaxPullTime=58 --delay=1')->name('sunbet_bet_record')->cron('*/2 * * * *');
//            $schedule->command('get:record --plat=lg')->name('lg_bet_record')->everyMinute();
//            $schedule->command('get:record --plat=qly')->name('qly_bet_record')->everyMinute();
            //$schedule->command('get:record --plat=gg')->name('gg_bet_record')->everyMinute();
            $schedule->command('get:record --plat=gg')->name('gg_bet_record')->hourly();
            $schedule->command('get:record --plat=yc  --interval=15  --firstMaxPullTime=15 --delay=1')->name('yc_bet_record')->cron('*/5 * * * *');
//            $schedule->command('get:record --plat=yc  --interval=58  --firstMaxPullTime=58 --delay=1')->name('yc_bet_record')->everyMinute();
            $schedule->command('get:record --plat=bg --interval=1  --firstMaxPullTime=1 --delay=20')->name('bg_bet_record')->everyMinute();


            //清理历史数据,每月第一天凌晨1点执行
            $schedule->command('clear:bet')->monthlyOn(1, '01:00');
            //检查未知状态转账
            $schedule->command('transfer:check')->hourly();

        }

    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');

        require base_path('routes/console.php');
    }
}
